package service.impl;

import bean.ghj.awayrecord;
import bean.ghj.changerecord;
import bean.ghj.payrecord;
import dao.impl.recordQueryDaoImpl;
import service.recordQueryService;
import util.SysEnum;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;

public class recordQueryServiceImpl implements recordQueryService {

    recordQueryDaoImpl recordQueryDao = new recordQueryDaoImpl();

    @Override
    //判断调房记录
    public int regexChangeRecordInfo(Date date1,Date date2) throws SQLException {
        List<changerecord> cg = recordQueryDao.regexChangeRecordInfo(date1,date2);
        if(cg != null){
            //校验成功
            return SysEnum.SUCCESS.code;
        }else {
            return SysEnum.CHANGERECORD_NOT_FIND.code;
        }
    }

    @Override
    //打印调房记录
    public List<changerecord> regexChangeRecord(Date date1, Date date2) throws SQLException {
        List<changerecord> cg = recordQueryDao.regexChangeRecordInfo(date1,date2);
        return cg;

    }

    @Override
    //判断缴费记录
    public int regexPayRecordInfo(Date date1, Date date2) throws SQLException {
        List<payrecord> cg = recordQueryDao.regexPayRecordInfo(date1,date2);
        if(cg != null){
            //校验成功
            return SysEnum.SUCCESS.code;
        }else {
            return SysEnum.PAYRECORD_NOT_FIND.code;
        }
    }

    @Override
    //打印缴费记录
    public List<payrecord> regexPayRecord(Date date1, Date date2) throws SQLException {
        List<payrecord> cg = recordQueryDao.regexPayRecordInfo(date1,date2);
        return cg;
    }
    @Override
    //判断离宿记录
    public int regexAwayRecordInfo(Date date1, Date date2) throws SQLException {
        List<awayrecord> cg = recordQueryDao.regexAwayRecordInfo(date1,date2);
        if(cg != null){
            //校验成功
            return SysEnum.SUCCESS.code;
        }else {
            return SysEnum.AWAYRECORD_NOT_FIND.code;
        }
    }

    @Override
    //打印离宿记录
    public List<awayrecord> regexAwayRecord(Date date1, Date date2) throws SQLException {
        List<awayrecord> cg = recordQueryDao.regexAwayRecordInfo(date1,date2);
        return cg;
    }
}
